/**
   This class collects a number of values and counts the peaks and valleys. 
*/
public class DataSet
{
   private double lastValue;
   private double precedingValue;
   private int count;
   public int peaks;
   public int valleys;

   /**
      Constructs a new data set with no data.
   */
   public DataSet()
   {
      // your work here
      count=0;
      peaks=0;
      valleys=0;
   }

   /**
      Adds a value to this data set.
      @param valueToAdd the value to add to this data set
   */
   public void add(double valueToAdd)
   {      
      // your work here
      valleys+=valueToAdd;
   }

   /**
      Gets the number of peaks in this data set.
      @return the number of peaks in this data set
   */
   public int getPeakCount()
   {
      return peaks;
   }

   /**
      Gets the number of valleys in this data set.
      @return the number of valleys in this data set
   */
   public int getValleyCount()
   {
      return valleys;
   }
}